﻿//using System;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Linq;
//using System.Web.Mvc;
//using System.Web.UI.WebControls;
//using Microsoft.Ajax.Utilities;
//using Developer.Entity;
//using Developer.Service;
//using Super.Framework.Common;
//using Super.Framework.Common.Web;
//using Super.Framework.EF;
//using System.Data.Entity;
//using System.Linq.Dynamic;

//namespace Developer.Web.Areas.Admin.Controllers
//{
//    public class CompanyController : BaseController
//    {
//        /// <summary>
//        /// 首页列表
//        /// </summary>
//        /// <returns></returns>
//        public ActionResult Index ()
//        {
//            var pageIndex = Query.Value("page").ToInt(1);

//            int pageCount;
//            int itemCount;
//            var companytypes = CompanyTypeService.GetAll().Where(ct => ct.IsAbort == false).ToList();
//            var list = companytypes.OrderByDescending(ct => ct.CreateTime)
//                .Page(out itemCount, out pageCount, pageIndex: pageIndex, pageSize: PageSize);
//            ViewBag.pageCount = pageCount;
//            ViewBag.itemCount = itemCount;
//            return View( list );
//        }

//        /// <summary>
//        /// 新增和修改页面
//        /// </summary>
//        /// <returns></returns>
//        public ActionResult Edit ()
//        {
//            var typeId = Query.Value("typeId").ToInt();
//            var companytype=new CompanyType();
//            if ( typeId > 0 )
//            {
//                companytype = CompanyTypeService.GetAll().FirstOrDefault( c => c.Id == typeId );
//            }

//            return View( companytype );
//        }

//        /// <summary>
//        /// 保存新增和修改
//        /// </summary>
//        /// <param name="z"></param>
//        /// <returns></returns>
//        [HttpPost]
//        public ActionResult Edit ( int? z )
//        {
//            var typename = Query.Value("typename");
//            var typeId = Query.Value("typeId").ToInt();
//            var companytype=new CompanyType();
//            if (typeId>0)
//            {
//                companytype= CompanyTypeService.GetAll().FirstOrDefault( c => c.Id == typeId );
//                companytype.Name = typename;
//                CompanyTypeService.Change(companytype);
//            }
//            companytype.Name = typename;
//            companytype.CreateTime=DateTime.Now;
//            companytype.IsAbort = false;
//            CompanyTypeService.Add(companytype);
//            ShowMsg("操作成功",MessageItemType.Right);
//            return View(companytype);
//        }

//        /// <summary>
//        /// 删除
//        /// </summary>
//        /// <returns></returns>
//        public ActionResult Delete ()
//        {
//            var typeId = Query.Value("typeId").ToInt();
//            if ( typeId > 0 )
//            {
//                CompanyTypeService.Remove( typeId );
//                ShowMsg( "操作成功!" , MessageItemType.Right );
//                return Redirect( "/admin/company/index" );
//            }
//            ShowMsg( "操作失败,参数不正确!" , MessageItemType.Error );
//            return Redirect( "/admin/company/index" );
//        }

//        /// <summary>
//        /// 批量删除
//        /// </summary>
//        /// <returns></returns>
//        [HttpPost]
//        public bool BatDelete ()
//        {
//            var typeIds = Query.Value("typeIds[]").Split(',');
//            if ( typeIds.Length < 1 ) return false;
//            foreach ( var t in typeIds )
//            {
//                CompanyTypeService.Remove( t.ToInt() );
//            }
//            return true;
//        }
//    }
//}